

package Dal;
import java.sql.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 *
 * @author Adrian Miranda Melgar
 */

public class TDatos_sql {
    protected Connection cn;
    protected Statement st;
    Connection com=null;
    
    public TDatos_sql() throws SQLException {
        String url="";
        try {
            Class.forName("oracle.jdbc.driver.OracleDriver");
            this.cn=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","upds2014");
        }
        catch (Exception E){
            System.out.println(E.getMessage());
        }
    }
    public boolean ejecutar(String strsql) throws SQLException{
        this.st=this.cn.createStatement();
        return(this.st.executeUpdate(strsql)>0);
    }
    public ResultSet seleccionar(String srtcad) throws SQLException{
         this.st=this.cn.createStatement();
         return this.st.executeQuery(srtcad);
    }
}
